import tornado.ioloop
import tornado.web
import os


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.render("index.html")


def make_app():
    return tornado.web.Application(
        # 路由
        [
            (r"/", MainHandler),
        ],
        # 网页模板
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        # 静态路径
        static_path=os.path.join(os.path.dirname(__file__),"static")
    )


if __name__ == "__main__":
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()
